
<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>任务管理</title>
    <link href="../../nuoyi/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../../nuoyi/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../../nuoyi/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20201129" rel="stylesheet"/>
    <link href="../../nuoyi/css/animate.css" rel="stylesheet"/>
    <link href="../../nuoyi/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="../../nuoyi/ruoyi/css/ry-ui.css?v=4.6.0" rel="stylesheet"/>

</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>
                            角色名称：<input type="text" name="roleName"/>
                        </li>
                        <li>
                            权限字符：<input type="text" name="roleKey"/>
                        </li>
                        <li>
                            角色状态：<select name="status">
                            <option value="">所有</option>
                            <option value="0">正常</option>
                            <option value="1">停用</option>
                        </select>
                        </li>
                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="addorder()">
                <i class="fa fa-plus"></i> 新增订单
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div id="order-info" style="display: none">
    <div align="center">
        <img src="" id="Qr-code-img">
    </div>
</div>
<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="../../nuoyi/js/jquery.min.js"></script>
<script src="../../nuoyi/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../../nuoyi/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20201129"></script>
<script src="../../nuoyi/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20201129"></script>
<script src="../../nuoyi/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js?v=20201129"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../../nuoyi/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="../../nuoyi/ajax/libs/validate/messages_zh.min.js"></script>
<script src="../../nuoyi/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../../nuoyi/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- 遮罩层 -->
<script src="../../nuoyi/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../../nuoyi/ajax/libs/iCheck/icheck.min.js"></script>
<script src="../../nuoyi/ajax/libs/layer/layer.min.js"></script>
<script src="../../nuoyi/ajax/libs/layui/layui.js"></script>
<script src="../../nuoyi/ruoyi/js/common.js?v=4.6.0"></script>
<script src="../../nuoyi/ruoyi/js/ry-ui.js?v=4.6.0"></script>

<script class="addorder" type="text/html">
    <div class="form-group">
        <input type="text" placeholder="请输入商品信息" id="subject" class="form-control">
        <br>
        <input type="text" placeholder="请输入商品金额" id="totalmount" class="form-control">
        <br>
        <input type="text" placeholder="请输入商品描述" id="body" class="form-control">
        <br>
    </div>
</script>



<script>


    $(function() {
        var options = {
            url: "/order/list",
            modalName: "订单列表",
            columns: [{
                checkbox: true
            },
                {
                    title: '序号',
                    align: 'center',
                    halign: 'center',
                    width: 40,
                    formatter: function (value, row, index) {
                        //获取每页显示的数量
                        var pageSize=$('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber=$('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;
                    }
                },
                {
                    field: 'outTradeNo',
                    title: '订单编号'
                },
                {
                    field: 'subject',
                    title: '订单名称'
                },
                {
                    title: '订单金额',
                    align: 'center',
                    width: 100,
                    formatter: function (value, row, index) {
                        return '￥'+row.totalMount+' 元';
                    }
                },
                {
                    field: 'body',
                    title: '订单备注'
                }
                ,
                {
                    field: 'createTime',
                    title: '创建时间'
                }
            ]
        };
        $.table.init(options);
    });

    function submitOrder() {
         var subject=$("#subject").val();
         var money=$("#totalmount").val();
         var body=$("#body").val();
         var data1=urldata('post','/order/createOrd',{'subject':subject,'money':money,'body':body})
         var url=data1.url;
         $("#Qr-code-img").attr("src",url);
        layer.open({
            content: $('#order-info').html()
            ,area: ['400px', '350px'] //自定义文本域宽高
            ,title:'订单支付'
            ,btn: ['确定', '取消']
            ,yes: function(){

            }
            ,btn2: function(){
                //按钮【取消】的回调
                return 0;
            }
        });

    }

    function addorder() {
        layer.open({
            content: $('.addorder').html()
            ,area: ['500px', '400'] //自定义文本域宽高
            ,title:'订单新增'
            ,btn: ['确定', '取消']
            ,yes: function(){
                submitOrder();
            }
            ,btn2: function(){
                //按钮【取消】的回调
                return 0;
            }
        });
    }

    function urldata(requestObject,url,data) {
        var data1='';
        $.ajax({
            type: requestObject,
            url: url,
            data:data,
            async:false,
            success: function(data) {
                data1=data;
            }
        })
        return data1
    }




</script>
</body>
</html>